home *** CD-ROM | disk | FTP | other *** search
- % Trace individual operators or procedures.
- % <opname> traceop prints vmem usage
- % <opname> <numargs|preproc> prints arguments or runs proc before
- % <opname> <numargs|preproc> <numresults|postproc>
- % also prints results or runs proc after
- % If traceflush is true, flush the output after each printout.
- /traceflush true def
-
- % Define the default "before" action
- /tracebefore { vmstatus 3 traceprint pop pop pop } def
-
- % Define the default "after" action
- /traceafter { } def
-
- /traceprint
- { dup type /integertype eq
- { 1 sub -1 0 { ( ) print index ==only } for }
- { exec }
- ifelse
- } bind def
- /traceend
- { traceflush { flush } if
- } bind def
- /traceop
- { userdict begin
- dup type /nametype eq { { tracebefore } } if
- 1 index type /nametype eq { { traceafter } } if
- /.tpost exch def /.tpre exch def /.tname exch def
- .tname where not { .tname {} def userdict } if /.tdict exch def
- .tdict dup systemdict eq { pop userdict } if /.tddict exch def
- [ .tname /=only cvx ( ) /print cvx
- /.tpre load /traceprint cvx /traceend cvx
- .tname load
- dup xcheck
- { dup type dup /arraytype eq exch /packedarraytype eq or
- { /exec cvx
- } if
- } if
- /.tpost load /traceprint cvx (\n) /print cvx /traceend cvx
- ] cvx .tddict exch .tname exch put end
- } bind def
- /bind { } def % disable
-